﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;

public partial class Password : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnOk_Click(object sender, EventArgs e)
    {
        BLL.B_Login bll = new B_Login();
        string strName = Session["LoginName"].ToString();
        string strConfirm = txtConfirm.Text.Trim();
        string strPass = txtPassword.Text.Trim();
        if ((strPass == "") & (strConfirm == ""))
        {
            Response.Write("密码不能为空，请输入口令！");
        }
            else
            {
                if (strPass != strConfirm )
            {
                Response.Write("两次密码不一致，请重新输入口令！");
            }
            else
            {
                if (bll.UpdatePassword(strName, strPass) == 1)
                {
                    Response.Write("修改成功！");
                    Response.Redirect("Main.aspx");
                }
                else
                {
                    Response.Write("系统错误！");
                }
            }
        }
    }
}